<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<div class="header">
	<h3>导入流程</h3>
</div>
<table class="form-table">
	<tr>
		<td class="td1">流程名称：</td>
		<td class="td2"><input type="text" id="processName"
			class="required">
		</td>
	</tr>
	<tr>
		<td class="td1">上传流程定义文件:</td>
		<td class="td2">
			<form id="importFileForm" action="fileUpload" method="post"
				enctype="multipart/form-data">
				<input id="xmlFile" name="xmlFile" type="file" style="width:90%">（仅支持bpmn20.xml格式）
			</form>
		</td>
	</tr>
</table>

<isperp:buttonList>
	<button onclick="importProcess();" class="nui-mainbtn">保存</button>
</isperp:buttonList>

<script type="text/javascript">
	function importProcess() {

		isperp.submitForm({
			formId : "importFileForm",
			success : function(data) {
				var path = data.path;

				$.post("workflow/processDefinition/deploy", {
					filePath : path,
					processName : $("#processName").val()
				}, function() {
					isperp.infoAlert("流程导入成功！");
				});

			},
			error : function() {
				isperp.errorAlert("流程导入失败！");
			}

		});

	}
</script>